﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Vit.Common
{
    public class EnumWrapper<T>
    {
        public T EnumValue { get; set; }

        public int IntValue
        {

            get { return (int)(object)EnumValue; }

            set { EnumValue = (T)(object)value; }

        }

        public static implicit operator EnumWrapper<T>(T enumValue)
        {
            return new EnumWrapper<T>() { EnumValue = enumValue };
        }

        public static implicit operator T(EnumWrapper<T> enumWrapper)
        {
            if (enumWrapper == null)
                return default(T);
            return (T)enumWrapper.EnumValue;
        }
    }
}
